<?php
/*
whmtools - easily find accounts on cpanels servers
Copyright (C) 2006  Matthew Davis <matthew@familycampground.org>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

include 'config.php';

$result = mysql_query("SELECT DISTINCT domain FROM accounts");
while ($accounts = mysql_fetch_row($result)) {
    $another = mysql_query("SELECT COUNT(*) from accounts where `domain` like '${accounts[0]}'");
    if (mysql_result($another,0)>1) {
	$query = mysql_query("SELECT * FROM accounts WHERE `domain` LIKE '${accounts[0]}'");
	print "<table border=1>\n";
	while ($stuff = mysql_fetch_row($query)){
	    print "<tr><td>$stuff[0]</<td><td>$stuff[1]</td><td>$stuff[2]</td><td>$stuff[3]</td><td><a href=\"http://www.dnsstuff.com/tools/whois.ch?ip=$stuff[3]\"><img src=\"images/icon_lookup.gif\" alt=\"Whois\" border=0></a> <a href=\"http://www.dnsstuff.com/tools/lookup.ch?name=$stuff[3]&type=A\" title=\"DNS Lookup\">D</a></td><td>$stuff[4]</td><td>$stuff[6]</td></tr>\n";
	}
	print "</table><br>\n";
    }
}

?>
